<template>
  <div :spinning="confirmLoading">
    <a-page-header :ghost="false" :title="projectStatus" style="margin-top: -20px;">
      <a-descriptions size="small" :column="3">
        <a-descriptions-item label="项目编号"> {{xmbh}} </a-descriptions-item>
        <a-descriptions-item label="发包企业"> {{gsmc}} </a-descriptions-item>
        <a-descriptions-item label="发起时间"> {{tjsj}} </a-descriptions-item>
      </a-descriptions>
    </a-page-header>
    <a-page-header :ghost="false" title="项目基本信息"style="background-color: #F5F5F5">
      <j-form-container :disabled="true">
        <a-form :form="form" slot="detail">
          <a-row>
            <a-col :span="24">
              <a-form-item label="工作城市" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                <!--<j-area-linkage v-decorator="['gzcs']" type="cascader"/>-->
                <a-input v-decorator="['gzcsmc']" ></a-input>
              </a-form-item>
            </a-col>
            <a-col :span="24">
              <a-form-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                <a-input v-decorator="['xmmc']" ></a-input>
              </a-form-item>
            </a-col>
            <a-col :span="24">
              <a-form-item label="项目类型" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                <j-dict-select-tag v-decorator="['xmlxid']" dictCode="hydm"></j-dict-select-tag>
              </a-form-item>
            </a-col>
            <a-col :span="24">
              <a-form-item label="项目内容" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                <a-textarea v-decorator="['xmnr']" :rows="4" ></a-textarea>
              </a-form-item>
            </a-col>
            <a-col :span="24">
              <a-form-item label="验收标准" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                <a-textarea v-decorator="['ysbz']" :rows="4" ></a-textarea>
              </a-form-item>
            </a-col>
            <a-col :span="24">
              <a-form-item label="结算方式 " :labelCol="labelCol" :wrapperCol="wrapperCol">
                <j-dict-select-tag type="radio" v-decorator="['jsfs']" :trigger-change="true" dictCode="project_jsfs" placeholder="请选择结算方式 "/>
              </a-form-item>
            </a-col>
            <a-col :span="24">
              <a-form-item label="单人结算金额" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                <a-input v-decorator="['drjsje', validatorRules.drjsje]" ></a-input>
              </a-form-item>
            </a-col>
            <!--<a-col :span="24">-->
            <!--  <a-form-item label="任务总金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">-->
            <!--    <a-input-number v-decorator="['rwzje', { rules: [{ required: true, message: '请输入任务总金额!' }] }]" :precision="2" :min="0.01" style="width: 100%" />-->
            <!--  </a-form-item>-->
            <!--</a-col>-->
            <a-col :span="10" style="margin-left: 68px;">
              <a-form-item label="需要人数" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 12 }}" style="height: 25px;">
                <a-input-number v-decorator="['xyrs']" :precision="0" :min="0" style="width: 90%" ></a-input-number> 人
              </a-form-item>
            </a-col>
            <a-col :span="7" style="margin-left: 102px;">
              <a-form-item label="年龄要求" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 10 }}" style="height: 25px;">
                <j-dict-select-tag v-decorator="['nlyq']" :triggerChange="true" dictCode="nlyq_dict"></j-dict-select-tag>
              </a-form-item>
            </a-col>
            <a-col :span="7">
              <a-form-item label="学历要求" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 10 }}" style="height: 25px;">
                <j-dict-select-tag v-decorator="['xlyq']" :triggerChange="true" dictCode="xlyq_dict"></j-dict-select-tag>
              </a-form-item>
            </a-col>
            <a-col :span="7">
              <a-form-item label="经验要求" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 10 }}" style="height: 25px;">
                <j-dict-select-tag v-decorator="['jyyq']" :triggerChange="true" dictCode="jyyq_dict"></j-dict-select-tag>
              </a-form-item>
            </a-col>
            <a-col :span="11" style="margin-left: 100px;">
              <a-form-item label="项目起止日" :labelCol="labelCol" :wrapperCol="wrapperCol">
                <a-date-picker v-decorator="['xmqrq']" format="YYYY-MM-DD"  /> -- <a-date-picker v-decorator="['xmzrq']" format="YYYY-MM-DD" />
              </a-form-item>
            </a-col>
            <a-col :span="10">
              <a-form-item label="工作时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                <j-time v-decorator="['gzkssj']" date-format="HH:mm" /> -- <j-time v-decorator="['gzjssj']" date-format="HH:mm"/>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </j-form-container>
    </a-page-header>
    <a-page-header v-show="detailView" :ghost="false" title="任务接收者信息列表" style="background-color: #F5F5F5; margin-top: 20px;">
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true, y:340}"
        bordered
        rowKey="id"
        :pagination="false"
        :columns="dColumns"
        :dataSource="dData"
        :loading="loading"
        class="j-table-force-nowrap">

        <span slot="action" slot-scope="text, record"  >
          <a v-if="record.isSign == 1" @click="downloadFile(record.htpdf)">合同</a>
          <a-divider v-if="record.hiredStatus === '4' && record.isSign == '1'" type="vertical"/>
          <a v-if="record.hiredStatus == 4" @click="updateHiredStatus(record.individualid, record.projectid, 5)">同意解聘</a>
          <a-divider v-if="record.hiredStatus === '4'" type="vertical"/>
          <a v-if="record.hiredStatus == 4" @click="updateHiredStatus(record.individualid, record.projectid, 2)">拒绝解聘</a>
          <!--<a  @click="downloadFile(record.htpdf)">record.htpdf</a>-->
        </span>

      </a-table>
    </a-page-header>
    <a-page-header v-show="editView" :ghost="false" title="任务接收者信息列表" style="background-color: #F5F5F5; margin-top: 20px;">
      <div class="table-operator">
        <a-button @click="AddSkr" type="primary" icon="plus">新增</a-button>
        <a-upload v-show="true" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
                  @change="skrhandleImportExcel">
          <a-button type="primary" icon="import">导入</a-button>
        </a-upload>
        <a-button type="primary" icon="download"><a href="http://61.161.232.20:20201/mb/灵工人员信息列表.xls" download="任务接收者信息列表.xls" style="color: white">下载模板</a></a-button>
       </div>
      <j-vxe-table
          ref="vTable"
          row-number
          keep-source
          :height="300"
          :dataSource="skrData"
          :columns="skrColumns"
          style="margin-top: 8px;"
        >
          <template v-slot:action="props">
            <a-popconfirm title="确定删除吗？" @confirm="handleDL(props)">
              <a>删除</a>
            </a-popconfirm>
            <!--<a-divider v-if="props.row.usertype == '待注册用户'" type="vertical"/>
            <a-popconfirm v-if="props.row.usertype == '待注册用户'" :title="'确认给'+props.row.name+'发送短信邀请，手机号为 '+props.row.phone+' ？'" @confirm="sendZcMessage(props)">
              <a>发送短信</a>
            </a-popconfirm>-->
          </template>
        </j-vxe-table>
    </a-page-header>
    <j-modal title="任务接收者信息录入" :visible="showFlowSkr" @ok="handleOk" @cancel="handleCancel" :width="800">
      <a-form >
        <a-row :gutter="24">
          <a-col>
            <a-form-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" >
              <a-input v-model="tjrList.name"></a-input>
            </a-form-item>
          </a-col>
          <a-col>
            <a-form-item label="身份证号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-model="tjrList.identityid"></a-input>
            </a-form-item>
          </a-col>
          <a-col>
            <a-form-item label="手机号11" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-model="tjrList.phone"></a-input>
            </a-form-item>
          </a-col>
          <a-col>
            <a-form-item label="任务金额（元）" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-number v-model="tjrList.rwje" style="width: 100%;" :precision="2" :min="0" :max="99999999.99" ></a-input-number>
            </a-form-item>
          </a-col>
          <a-col>
            <a-form-item label="操作" :labelCol="labelCol" :wrapperCol="wrapperCol">

            </a-form-item>
          </a-col>
        </a-row>

      </a-form>
    </j-modal>

  </div>
</template>

<script>

  import { httpAction, getAction, postAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JFormContainer from '@/components/jeecg/JFormContainer'
  import JDate from '@/components/jeecg/JDate'
  import JDictSelectTag from "@/components/dict/JDictSelectTag"
  import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
  import JTime from '@/components/jeecg/JTime'
  import { JVXETypes } from '@/components/jeecg/JVxeTable'
  import Area from '@/components/_util/Area'

  let recordBean;

  export default {
    name: 'LhygProjectForm',
    mixins:[JeecgListMixin],
    components: {
      JFormContainer,
      JDate,
      JDictSelectTag,
      JAreaLinkage,
      JTime,
    },
    props: {
      //流程表单data
      formData: {
        type: Object,
        default: ()=>{},
        required: false
      },
      //表单模式：true流程表单 false普通表单
      formBpm: {
        type: Boolean,
        default: false,
        required: false
      },
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        form: this.$form.createForm(this),
        confirmLoading: false,
        showFlowSkr: false,
        detailView: false,
        editView: false,
        gsmc: '',
        projectStatus: '',
        xmbh: '',
        tjsj: '',
        xmxybh: '',
        xmlxid: '',
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 4 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 19 },
        },
        validatorRules: {
        },
        url: {
          queryById: "/project/lhygProject/queryById",
          getSkrList: "/project/lhygProject/getSkrList",
          importExcelUrl:"project/lhygProject/importSkrExcel",
          // sendZcMessage: "/project/lhygProject/sendZcMessage",
          getSkrInfo: "/project/lhygProject/getSkrInfo",
          saveSkrUrl: "/project/lhygProjectIndividual/addList",
          updateHiredStatus: "/project/lhygProject/updateHiredStatus",
        },
        skrData: [],
        skrColumns: [
          {
            title:'姓名',
            align:"center",
            key: 'name',
            type: JVXETypes.normal,
            width: '110px',
          },
          {
            title:'身份证号',
            align:"center",
            key: 'identityid',
            type: JVXETypes.normal,
            width: '200px',
          },
          {
            title:'手机号',
            align:"center",
            key: 'phone',
            type: JVXETypes.normal,
            width: '140px',
          },
          {
            title:'任务金额（元）',
            align:"center",
            key: 'rwje',
            type: JVXETypes.inputNumber,
            width: '150px',
            validateRules: [
              {
                required: true, // 必填
                message: '请输入${title}' // 显示的文本
              },
              {
                pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/, // 正则 /^(([0-3]{0,1}[0-9]{0,4})|(([0]\.\d{1,2}|[0-3]{0,1}[0-9]{0,4}\.\d{1,2})))$/,
                message: '${title}必须大于等于0且最多保留两位小数'
              },
            ]
          },
          // {
          //   title:'是否完成',
          //   align:"center",
          //   key: 'sfwc',
          //   width: '80px',
          //   type: JVXETypes.normal,
          //   customRender:function (text,record,index) {
          //     console.log('record= ' +record.status);
          //     if(record.status > 2){
          //         return "是"
          //     } else if(record.status > 0) {
          //         return "否"
          //     } else {
          //         return "-"
          //     }
          //   }
          // },
          {
            title:'备注',
            align:"center",
            key: 'bz',
            width: '180px',
            type: JVXETypes.textarea
          },
          {
              title:'人员状态',
              align:"center",
              dataIndex: 'bz',
              // ellipsis: true,
              key: 'usertype',
              width: '110px',
              type: JVXETypes.normal,
          },
          {
              title: '操作',
              key: 'action',
              type: JVXETypes.slot,
              fixed: 'right',
              width: '150px',
              align: 'center',
              slotName: 'action',
          }
        ],
        tjrList: {
            name: '',
            identityid: '',
            phone: '',
            rwje: '',
            bz: '',
            usertype: '',
        },
        dData: [],
        dColumns: [
            {
                title:'姓名',
                align:"center",
                dataIndex: 'name',
                width: 150
            },
            {
                title:'身份证号',
                align:"center",
                dataIndex: 'identityid',
                width: 200
            },
            {
                title:'手机号',
                align:"center",
                dataIndex: 'phone',
                width: 150
            },
            {
                title:'任务金额（元）',
                align:"center",
                dataIndex: 'rwje',
                width: 150
            },
            {
                title:'是否完成',
                align:"center",
                dataIndex: 'sfwc',
                width: 150,
                customRender:function (text,record,index) {
                    if(record.status > 2){
                        return "是"
                    } else if(record.status > 0) {
                        return "否"
                    } else {
                        return "-"
                    }
                }
            },
            {
                title:'结算金额（元）',
                align:"center",
                dataIndex: 'fkje',
                width: 150,
                customRender:function (text,record,index) {
                    if(record.status == 8){
                        return text
                    } else {
                        return "-"
                    }
                }
            },
            {
              title:'当前状态',
              align:"center",
              dataIndex: 'hiredStatus',
              width: 150,
              customRender:function (text,record,index) {
                if(record.hiredStatus === '1'){
                  return "已报名"
                } else if(record.hiredStatus === '2') {
                  return "已录取"
                } else if(record.hiredStatus === '3') {
                  return "已拒绝"
                } else if(record.hiredStatus === '4') {
                  return "解聘审批中"
                } else if(record.hiredStatus === '5') {
                  return "已解聘"
                }
              }

            },
          {
            title: '合同',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:200,
            scopedSlots: { customRender: 'action' }
          },
        ],
      }
    },
    computed: {
      importExcelUrl: function () {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}?xmlxid=`+ this.xmlxid;
      },
      formDisabled(){
        if(this.formBpm===true){
          if(this.formData.disabled===false){
            return false
          }
          return true
        }
        return this.disabled
      },
      showFlowSubmitButton(){
        if(this.formBpm===true){
          if(this.formData.disabled===false){
            return true
          }
        }
        return false
      }
    },
    created () {
      //如果是流程中表单，则需要加载流程表单data
      this.showFlowData();
      this.mixin_pca = new Area();
    },
    methods: {

      edit (record) {
        recordBean = record;
        this.xmlxid = record.xmlxid;
        this.form.resetFields();
        // this.visible = true;
        this.detailView = false;
        this.editView = true;
        this.model = Object.assign({}, record);
        this.getSkrList(record.id, record.xmlxid);
        this.xmbh = record.xmbh;
        this.tjsj = record.tjsj;
        this.gsmc = record.gsmc;
        this.projectStatus = record.status_dictText;

        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,'gzcsmc','xmmc','xmlxid','xmnr','ysbz','xmzys','xyrs','nlyq','xlyq','jyyq','xmqrq','xmzrq','gzkssj','gzjssj','rwzje','ptfwf','drjsje','jsfs'))
        })
      },
      handleDetail(){},
      handleEdit(){},

      detailRecord (record){
          let detail_this = this;
          recordBean = record;
          detail_this.xmlxid = record.xmlxid;

          detail_this.form.resetFields();
          detail_this.model = Object.assign({}, record);
          // detail_this.visible = true;
          detail_this.detailView = true;
          detail_this.editView = false;

          let formData=new FormData();
          formData.append('id',record.id);
          formData.append('xmlxid', record.xmlxid);
          formData.append('type', "3");
          postAction(detail_this.url.getSkrList, formData).then(res => {
              if (res.success) {
                  detail_this.dData = res.result;
              } else {
                  detail_this.$message.warning(res.message);
              }
          }).catch((e) => {
              this.$message.error('查询任务接收者列表时异常');
          });
          detail_this.xmbh = record.xmbh;
          detail_this.tjsj = record.tjsj;
          detail_this.gsmc = record.gsmc;
          detail_this.projectStatus = record.status_dictText;

          detail_this.$nextTick(() => {
              detail_this.form.setFieldsValue(pick(detail_this.model,'gzcsmc','xmmc','xmlxid','xmnr','ysbz','xmzys','rwzje','ptfwf','xyrs','nlyq','xlyq','jyyq','xmqrq','xmzrq','gzkssj','gzjssj','drjsje','jsfs'))
          })
      },
      cancel(){
      },
      //渲染流程表单数据
      showFlowData(){
        if(this.formBpm === true){
          let params = {id:this.formData.dataId};
          getAction(this.url.queryById,params).then((res)=>{
            if(res.success){
              this.edit (res.result);
            }
          });
        }
      },
      updateHiredStatus(individualid, projectid, hiredStatus){
        let formData=new FormData();
        formData.append('id', individualid);
        formData.append('hiredStatus', hiredStatus);
        postAction(this.url.updateHiredStatus, formData).then(res => {
          if (res.success) {
            this.getSkrList(projectid, "1");//这个1没有任何意义,这个项目用不上
            this.$message.success("操作成功");
          } else {
            skrThis.$message.warning(res.message);
          }
        }).catch((e) => {
          skrThis.$message.error('查询任务接收者列表时异常');
        });
      },
      getSkrList(id, xmlxid){
        let skrThis = this;
        let formData=new FormData();
        formData.append('id', id);
        formData.append('xmlxid', xmlxid);
        formData.append('type', "3");
        postAction(skrThis.url.getSkrList, formData).then(res => {
            if (res.success) {
                skrThis.dData = res.result;
            } else {
                skrThis.$message.warning(res.message);
            }
        }).catch((e) => {
            skrThis.$message.error('查询任务接收者列表时异常');
        });
      },
      handleDL(props) {
        // 调用删除方法
        this.skrData.some((item,i) => {
            if(props.row.id == item.id){
                this.skrData.splice(i, 1);
                return true;
            }
        })
      },
      /*sendZcMessage(props){
          let that = this;
          if(props.row.phone == null || props.row.phone == "" || props.row.phone == undefined){
              that.$message.warning("此收款人手机号为空，无法发送短信");
          } else if(props.row.rwje == null || props.row.rwje == "" || props.row.rwje == undefined){
              that.$message.warning("此收款人任务金额为空，请录入任务金额");
          } else {
              getAction(that.url.sendZcMessage, {phone:props.row.phone, rwje:props.row.rwje, xmlx: recordBean.xmlxid_dictText}).then((res) => {
                  if (res.success){
                      that.$message.success(res.message);
                  }else{
                      that.$message.error(res.message)
                  }
              });
          }
      },*/
      AddSkr(){
        this.showFlowSkr = true;
      },
      handleOk(e) {
        let ok_this = this;
        let parphone = /^[1][3,4,5,7,8,9][0-9]{9}$/;
        let idReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
        if(ok_this.tjrList.name == "" || ok_this.tjrList.name == undefined){
            ok_this.$message.warning("请输入被推荐人姓名");
            return;
        } else if(!idReg.test(ok_this.tjrList.identityid)){
            ok_this.$message.warning("身份证号输入错误");
            return;
        } else if(!parphone.test(ok_this.tjrList.phone)){
            ok_this.$message.warning("手机号格式输入错误");
            return;
        } else if(ok_this.tjrList.rwje == "" || ok_this.tjrList.rwje == undefined){
            ok_this.$message.warning("请指定被推荐人任务金额");
            return;
        } else {
            let formData=new FormData();
            formData.append('phone', ok_this.tjrList.phone);
            formData.append('xmlxid', recordBean.xmlxid);
            formData.append('identityid', ok_this.tjrList.identityid);
            formData.append('type', 2);
            postAction(ok_this.url.getSkrInfo, formData).then(res => {
                if (res.success) {
                    if(res.result != null && res.result != "" && res.result != undefined ){
                        ok_this.tjrList.usertype = res.result.usertype;
                    } else {
                        ok_this.tjrList.usertype = '非注册用户';
                    }
                    ok_this.skrData.push(ok_this.tjrList);
                } else {
                    ok_this.$message.warning(res.message);
                }
                ok_this.handleCancel();
            }).catch((e) => {
                ok_this.$message.error("查询用户是否注册工商户时异常");
                ok_this.handleCancel();
            });
        }
      },
      handleCancel(e) {
        this.showFlowSkr = false;
        this.tjrList = {
            name: '',
            identityid: '',
            phone: '',
            rwje: '',
            bz: '',
            usertype: ''
        };
      },
      submitForm () {
        const that = this;
        that.$emit('changeLoading',true);
        let lpiData = [];
        let rwrMap = {};
        let idFlag = false;
        let sjMap = {};
        let sjFlag = false;
        let errSkr = false;
        let errNum = 0;
        let lineNum = "";
        let lineCount = 0;
        const reg = /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
        that.skrData.forEach((item,i) => {
          if(!rwrMap[that.skrData[i].identityid]){
              rwrMap[that.skrData[i].identityid] =  true;
          } else {
              idFlag = true;
              return;
          }
          if(!sjMap[that.skrData[i].phone]){
              sjMap[that.skrData[i].phone] = true;
          } else {
              sjFlag = true;
              return;
          }
          lineCount += 1;
          if(that.skrData[i].usertype == '税务已注销' || that.skrData[i].usertype == '黑名单'  || that.skrData[i].usertype == '手机号与身份信息不符'){
            errSkr = true;
          }
          if(that.skrData[i].rwje == undefined || that.skrData[i].rwje == '' || !reg.test(that.skrData[i].rwje)){
            errNum += 1;
            lineNum = lineNum + (i+1) + " , ";
            return;
          } else {
            let lpi = {
                projectid: '', individualid: '', individualphone: '', individualname: '',
                individualcard: '', phone: '',  rwje: '', fkje: '',  bz: ''
            };
            lpi.individualid = that.skrData[i].id;
            lpi.individualphone = that.skrData[i].phone;
            lpi.individualname = that.skrData[i].name;
            lpi.individualcard = that.skrData[i].identityid;
            lpi.rwje = that.skrData[i].rwje;
            lpi.fkje = that.skrData[i].rwje;
            lpi.bz = that.skrData[i].bz;
            lpiData.push(lpi);
          }
        })

        if(lineCount > recordBean.xyrs){
            that.$message.warning("任务接收人列表人数多于需要人数，请酌情删减或调整需要人数！");
            setTimeout(function () {
                that.$emit('changeLoading',false);
            }, 2000)
            return ;
        } else if(errSkr)　{
            that.$message.warning("任务接收人列表存在异常用户（黑名单/税务已注销/手机号与身份信息不符），请调整！");
            setTimeout(function () {
                that.$emit('changeLoading',false);
            }, 2000)
            return ;
        } else if(idFlag){
          that.$message.warning("任务接收人列表存在身份证号重复情况，请确认调整！");
          setTimeout(function () {
              that.$emit('changeLoading',false);
          }, 2000)
          return ;
        } else if(sjFlag){
            that.$message.warning("任务接收人列表存在手机号重复情况，请确认调整！");
            setTimeout(function () {
                that.$emit('changeLoading',false);
            }, 2000)
            return ;
        } else if(errNum > 0){
          that.$message.warning("请为第 "+lineNum.substring(0, lineNum.length-2)+" 行任务接收人指定正确的任务金额！");
          setTimeout(function () {
            that.$emit('changeLoading',false);
          }, 2000)
          return ;
        } else {
          console.log("表单提交数据",formData)
          let formData = new FormData();
          formData.append("projectid", recordBean.id);
          formData.append("lpiStr", JSON.stringify(lpiData));
          postAction(that.url.saveSkrUrl, formData ).then(res => {
            if (res.success) {
              that.skrData = [];
              that.$message.success(res.message);
              setTimeout(function () {
                that.$emit('changeLoading',false);
              }, 2000)
              that.$emit('ok');
            } else {
              setTimeout(function () {
                that.$emit('changeLoading',false);
              }, 2000)
              that.$message.warning(res.message);
            }
          }).catch((e) => {
            setTimeout(function () {
              that.$emit('changeLoading',false);
            }, 2000)
            that.$message.error('保存接收者列表时异常');
            that.confirmLoading = false;
          });
        }
      },
    }
  }
</script>
